package chain;

/**
 * 推荐写法
 *
 * @author: 张从龙
 * time: 2022/12/14 15:17
 */
public class MetaVo {

    private String title;
    private String icon;

    //（一）默认生成类型是void，修改为实体类
    public MetaVo setTitle(String title) {
        this.title = title;
        //（2）然后在加上这个return this;结束
        return this;
    }

    public String getTitle() {
        return title;
    }

    public String getIcon() {
        return icon;
    }

    public MetaVo setIcon(String icon) {
        this.icon = icon;
        return this;
    }

    @Override
    public String toString() {
        return "MetaVo{" +
                "title='" + title + '\'' +
                ", icon='" + icon + '\'' +
                '}';
    }


    public static void main(String[] args) {
        //测试链式编程
        MetaVo metaVo = new MetaVo().setIcon("1").setTitle("2");
        System.out.println(metaVo);
    }
}